﻿/*------------------------------------------------------------------------

IREBDERPIPE.HPP v1.1.22

Copyright 楊志賢 CxxlMan, 2012 - 2014
All Rights Reserved

------------------------------------------------------------------------*/

#if !defined(__IREBDERPIPE_HPP_Cxxl3D)
#define __IREBDERPIPE_HPP_Cxxl3D

#include <Sys\RENDERUNIT.HPP>

// 元件介面的識別碼
#define IRenderPipe_ClassID L"FEE1713C-59B5-4501-BF5A-4A97A0F081DF"

namespace Cxxl3D
{

class IRender;

// 要放入 IRenderPipe 須繼承此 Class
class IRDpkg:virtual public CxxlMan::cxxlObject
{
  CxxlMan::Smart_Ptr<IRenderDatagram> IRenderDatagram_Ptr;

public:
  // Constructor
  //IRDpkg(const CxxlMan::Smart_Ptr<IRenderDatagram> &IRenderDatagram_Arg)
  IRDpkg(IRenderDatagram *pIRenderDatagram_Arg)
    :cxxlObject(CxxlMan::Spirit_Easy),
    IRenderDatagram_Ptr(pIRenderDatagram_Arg,this)
  {
  }

  // Destructor
  virtual ~IRDpkg()
  {
  }

  CxxlMan::Smart_Ptr<IRenderDatagram> Get_IRenderDatagram()
  {
    return IRenderDatagram_Ptr;
  }
};

// 負責裝載要給 Render 渲染的物件
class IRenderPipe:virtual public CxxlMan::cxxlObject
{


protected:

public:
  // Constructor
  IRenderPipe()
    :cxxlObject(CxxlMan::Spirit_Easy)
  {}

  // Destructor
  virtual ~IRenderPipe()
  {}

  // 加入
  // 失敗表示要放入的物件已放入過了
  virtual bool cxxlFASTCALL Add(const CxxlMan::Smart_Ptr<IRDpkg> &IRenderUnit_Arg) = 0;

  // 將物件放入 refObj_Ptr 之前
  // 失敗表示要放入的物件已放入過了，或是 refObj_Ptr 不存在
  virtual bool cxxlFASTCALL Add_Prev(const CxxlMan::Smart_Ptr<IRDpkg> &addObj_Ptr, const CxxlMan::Smart_Ptr<IRDpkg> &refObj_Ptr) = 0;

  // 將物件放入 refObj_Ptr 之後
  // 失敗表示要放入的物件已放入過了，或是 refObj_Ptr 不存在
  virtual bool cxxlFASTCALL Add_Next(const CxxlMan::Smart_Ptr<IRDpkg> &addObj_Ptr, const CxxlMan::Smart_Ptr<IRDpkg> &refObj_Ptr) = 0;


  // 移除
  virtual void cxxlFASTCALL Del(const CxxlMan::Smart_Ptr<IRDpkg> &IRenderUnit_Arg) = 0;

  // 取得 IRenderDatagram List
  virtual CxxlMan::Smart_Ptr<CxxlMan::cxxlList<IRenderDatagram> > cxxlFASTCALL GetIRenderDatagramList() = 0;



  // 建立 IRenderPipe 物件，失敗傳回 NULL
  static CxxlMan::Smart_Ptr<IRenderPipe> cxxlFASTCALL Create()
  {
    return CxxlMan::Smart_Cast<IRenderPipe>( CxxlMan::cxxlCM_GetElement(IRenderPipe_ClassID, CXXL3DDEFAULTGROUP) );
  }

};

// 初始化，這裡只做元件註冊
inline void IRenderPipe_Init()
{
  CxxlMan::cxxlCM_ElementReg(IRenderPipe_ClassID, CXXL3DDEFAULTGROUP, L"C3dLib.dll");
}

}   /* namespace Cxxl3D */
#endif
